Optimal. Leaf size=101 \[ -\frac {(a B+b C) x}{a^2+b^2}-\frac {(b B-a C) \log (\cos (c+d x))}{\left (a^2+b^2\right ) d}+\frac {a^2 (b B-a C) \log (a+b \tan (c+d x))}{b^2 \left (a^2+b^2\right ) d}+\frac {C \tan (c+d x)}{b d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.17, antiderivative size = 101, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 38, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {3713, 3687,
3707, 3698, 31, 3556} \begin {gather*} \frac {a^2 (b B-a C) \log (a+b \tan (c+d x))}{b^2 d \left (a^2+b^2\right )}-\frac {(b B-a C) \log (\cos (c+d x))}{d \left (a^2+b^2\right )}-\frac {x (a B+b C)}{a^2+b^2}+\frac {C \tan (c+d x)}{b d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 31
Rule 3556
Rule 3687
Rule 3698
Rule 3707
Rule 3713
Rubi steps
\begin {align*} \int \frac {\tan (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{a+b \tan (c+d x)} \, dx &=\int \frac {\tan ^2(c+d x) (B+C \tan (c+d x))}{a+b \tan (c+d x)} \, dx\\ &=\frac {C \tan (c+d x)}{b d}+\frac {\int \frac {-a C-b C \tan (c+d x)+(b B-a C) \tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx}{b}\\ &=-\frac {(a B+b C) x}{a^2+b^2}+\frac {C \tan (c+d x)}{b d}+\frac {(b B-a C) \int \tan (c+d x) \, dx}{a^2+b^2}+\frac {\left (a^2 (b B-a C)\right ) \int \frac {1+\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx}{b \left (a^2+b^2\right )}\\ &=-\frac {(a B+b C) x}{a^2+b^2}-\frac {(b B-a C) \log (\cos (c+d x))}{\left (a^2+b^2\right ) d}+\frac {C \tan (c+d x)}{b d}+\frac {\left (a^2 (b B-a C)\right ) \text {Subst}\left (\int \frac {1}{a+x} \, dx,x,b \tan (c+d x)\right )}{b^2 \left (a^2+b^2\right ) d}\\ &=-\frac {(a B+b C) x}{a^2+b^2}-\frac {(b B-a C) \log (\cos (c+d x))}{\left (a^2+b^2\right ) d}+\frac {a^2 (b B-a C) \log (a+b \tan (c+d x))}{b^2 \left (a^2+b^2\right ) d}+\frac {C \tan (c+d x)}{b d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.49, size = 118, normalized size = 1.17 \begin {gather*} \frac {\frac {i (B+i C) \log (i-\tan (c+d x))}{a+i b}-\frac {(i B+C) \log (i+\tan (c+d x))}{a-i b}+\frac {2 a^2 (b B-a C) \log (a+b \tan (c+d x))}{b^2 \left (a^2+b^2\right )}+\frac {2 C \tan (c+d x)}{b}}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.18, size = 101, normalized size = 1.00
method | result | size |
derivativedivides | \(\frac {\frac {C \tan \left (d x +c \right )}{b}+\frac {a^{2} \left (B b -C a \right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{b^{2} \left (a^{2}+b^{2}\right )}+\frac {\frac {\left (B b -C a \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-a B -C b \right ) \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}}{d}\) | \(101\) |
default | \(\frac {\frac {C \tan \left (d x +c \right )}{b}+\frac {a^{2} \left (B b -C a \right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{b^{2} \left (a^{2}+b^{2}\right )}+\frac {\frac {\left (B b -C a \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-a B -C b \right ) \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}}{d}\) | \(101\) |
norman | \(\frac {C \tan \left (d x +c \right )}{b d}-\frac {\left (a B +C b \right ) x}{a^{2}+b^{2}}+\frac {a^{2} \left (B b -C a \right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{b^{2} \left (a^{2}+b^{2}\right ) d}+\frac {\left (B b -C a \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d \left (a^{2}+b^{2}\right )}\) | \(106\) |
risch | \(\frac {x B}{i b -a}-\frac {i x C}{i b -a}-\frac {2 i a^{2} B x}{b \left (a^{2}+b^{2}\right )}-\frac {2 i a^{2} B c}{b d \left (a^{2}+b^{2}\right )}+\frac {2 i a^{3} C x}{b^{2} \left (a^{2}+b^{2}\right )}+\frac {2 i a^{3} C c}{b^{2} d \left (a^{2}+b^{2}\right )}+\frac {2 i B x}{b}+\frac {2 i B c}{b d}-\frac {2 i C a x}{b^{2}}-\frac {2 i C a c}{b^{2} d}+\frac {2 i C}{b d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) B}{b d \left (a^{2}+b^{2}\right )}-\frac {a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) C}{b^{2} d \left (a^{2}+b^{2}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{b d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) C a}{b^{2} d}\) | \(320\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.51, size = 109, normalized size = 1.08 \begin {gather*} -\frac {\frac {2 \, {\left (B a + C b\right )} {\left (d x + c\right )}}{a^{2} + b^{2}} + \frac {2 \, {\left (C a^{3} - B a^{2} b\right )} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{2} b^{2} + b^{4}} + \frac {{\left (C a - B b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} - \frac {2 \, C \tan \left (d x + c\right )}{b}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 4.22, size = 149, normalized size = 1.48 \begin {gather*} -\frac {2 \, {\left (B a b^{2} + C b^{3}\right )} d x + {\left (C a^{3} - B a^{2} b\right )} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) - {\left (C a^{3} - B a^{2} b + C a b^{2} - B b^{3}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) - 2 \, {\left (C a^{2} b + C b^{3}\right )} \tan \left (d x + c\right )}{2 \, {\left (a^{2} b^{2} + b^{4}\right )} d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [C] Result contains complex when optimal does not.
time = 0.64, size = 1020, normalized size = 10.10 \begin {gather*} \begin {cases} \tilde {\infty } x \left (B \tan {\left (c \right )} + C \tan ^{2}{\left (c \right )}\right ) & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {i B d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {B d x}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {i B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {i B}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {3 C d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {3 i C d x}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {i C \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {C \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {2 C \tan ^{2}{\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {3 C}{2 b d \tan {\left (c + d x \right )} - 2 i b d} & \text {for}\: a = - i b \\- \frac {i B d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {B d x}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {i B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {i B}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {3 C d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {3 i C d x}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {i C \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {C \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {2 C \tan ^{2}{\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {3 C}{2 b d \tan {\left (c + d x \right )} + 2 i b d} & \text {for}\: a = i b \\\frac {- B x + \frac {B \tan {\left (c + d x \right )}}{d} - \frac {C \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {C \tan ^{2}{\left (c + d x \right )}}{2 d}}{a} & \text {for}\: b = 0 \\\frac {x \left (B \tan {\left (c \right )} + C \tan ^{2}{\left (c \right )}\right ) \tan {\left (c \right )}}{a + b \tan {\left (c \right )}} & \text {for}\: d = 0 \\\frac {2 B a^{2} b \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )}}{2 a^{2} b^{2} d + 2 b^{4} d} - \frac {2 B a b^{2} d x}{2 a^{2} b^{2} d + 2 b^{4} d} + \frac {B b^{3} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{2} b^{2} d + 2 b^{4} d} - \frac {2 C a^{3} \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )}}{2 a^{2} b^{2} d + 2 b^{4} d} + \frac {2 C a^{2} b \tan {\left (c + d x \right )}}{2 a^{2} b^{2} d + 2 b^{4} d} - \frac {C a b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{2} b^{2} d + 2 b^{4} d} - \frac {2 C b^{3} d x}{2 a^{2} b^{2} d + 2 b^{4} d} + \frac {2 C b^{3} \tan {\left (c + d x \right )}}{2 a^{2} b^{2} d + 2 b^{4} d} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.69, size = 110, normalized size = 1.09 \begin {gather*} -\frac {\frac {2 \, {\left (B a + C b\right )} {\left (d x + c\right )}}{a^{2} + b^{2}} + \frac {{\left (C a - B b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} + \frac {2 \, {\left (C a^{3} - B a^{2} b\right )} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{2} b^{2} + b^{4}} - \frac {2 \, C \tan \left (d x + c\right )}{b}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 8.77, size = 117, normalized size = 1.16 \begin {gather*} \frac {C\,\mathrm {tan}\left (c+d\,x\right )}{b\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B-C\,1{}\mathrm {i}\right )}{2\,d\,\left (b+a\,1{}\mathrm {i}\right )}-\frac {\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )\,\left (C\,a^3-B\,a^2\,b\right )}{d\,\left (a^2\,b^2+b^4\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (-C+B\,1{}\mathrm {i}\right )}{2\,d\,\left (a+b\,1{}\mathrm {i}\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________